#pragma once

#include "vrdatacore_global.h"
#include "notransformactor.h"
#include <QVector>
#include <QMap>

class QEvent;

namespace VrDataCore
{
	class OperationBase;
	class DrawableActor;
	class Map;

	class VRDATACORE_EXPORT TriggerBase:public NoTransformActor
	{
	public:
		TriggerBase();
		void addTriggerObject(DrawableActor* object);
		QVector<DrawableActor*> getTriggerObjects();
		void setTriggerObjectsId(QString id);
		QString getTriggerObjectsId();
		void setOperationId(QString id);
		QString getOperationId();
		void setOperationType(QString type);
		QString getOperationType();
		QEvent* getQtEvent();
		void setOperation(CoreBase::ActorBase* actor);
		CoreBase::ActorBase* getOperation();
		virtual void setEventKeyInt(int key);
		virtual void setEventTypeInt(int type);
		virtual void setEventMaskInt(int mask);
		virtual int getEventKeyInt();
		virtual int getEventTypeInt();
		virtual int getEventMaskInt();
		virtual bool testTrigger();
		virtual void setQtEvent(QEvent* event);
		virtual void acceptEvent(TriggerBase* event);
		virtual void onMapLoadBegin(CoreBase::Map*){}
		virtual void onMapLoadEnd(CoreBase::Map*);
		virtual void buildPropertyMap();
	protected:
		~TriggerBase();
		int _triggerType;
		QVector<DrawableActor*>				_triggerObjects;
		QEvent*								_qtEvent;
		QString								_objectId;
		QString								_eventType;
		QString								_eventKey;
		int									_eventTypeEnum;
		int									_eventKeyEnum;
		int									_eventMask;
		QString								_operationId;
		QString								_operationType;
		OperationBase*						_operationBase;
		QMap<QString,QString>				_operationNameToActor;

		virtual void setEventTypeInt(const QString& type);
		virtual void setEventKeyInt(const QString& type);
	};
}